﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LotteryVote.Entity;
using LotteryVote.Utility;

namespace LotteryVote.Controls
{
    public partial class UserSearchBar : System.Web.UI.UserControl
    {
        public string Name
        {
            get
            {
                return txt_name.Text;
            }
        }
        public string UserName
        {
            get
            {
                return txt_userName.Text;
            }
        }
        public UserState UserState
        {
            get
            {
                return lv_userState.SelectedState;
            }
        }
        public string Sort
        {
            get
            {
                return ddl_sort.SelectedValue;
            }
        }
        /// <summary>
        /// 是否搜索
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is searched; otherwise, <c>false</c>.
        /// </value>
        public bool IsSearched
        {
            get
            {
                return hd_searched.Value == "1";
            }
        }
        public event EventHandler OnSeach;

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_search_Click(object sender, EventArgs e)
        {
            if (!IsSearched)
                SetSearched();
            if (OnSeach != null)
                OnSeach(this, e);
        }

        private void SetSearched()
        {
            hd_searched.Value = "1";
        }
    }
}